<?php

	/**
	 * Class used for helping on debugging POP objects
	 * 
	 * @package pop
	 * @subpackage core
	 */
	abstract class POPDebug
	{
		/**
		 * Method used to send log messages
		 * @param $msg
		 * @return void
		 */
		public static function log($msg)
		{
			if (function_exists('fb') && POPEnvironment::$firephp){FB::log('POP message: '.$msg);}
			if (POPEnvironment::$debug) echo "<font color=#009900>LOG: ".$msg."</font><br>\n";
		}
		
		/**
		 * Method used to send info messages
		 * @param $msg
		 * @return void
		 */
		public static function info($msg)
		{
			if (function_exists('fb') && POPEnvironment::$firephp){FB::info('POP message: '.$msg);}
			if (POPEnvironment::$debug) echo "<font color=#0000FF>INFO: ".$msg."</font><br>\n";
		}
		
		/**
		 * Method used to send warnings messages
		 * @param $msg
		 * @return void
		 */
		public static function warn($msg)
		{
			if (function_exists('fb') && POPEnvironment::$firephp){FB::warn('POP message: '.$msg);}
			if (POPEnvironment::$debug) echo "<font color=#999900>WARN: ".$msg."</font><br>\n";
		}
		
		/**
		 * Method used to send error messages
		 * @param $msg
		 * @return void
		 */
		public static function error($msg)
		{
			if (function_exists('fb') && POPEnvironment::$firephp){FB::error('POP message: '.$msg);}
			if (POPEnvironment::$debug) echo "<font color=#FF0000>ERROR: ".$msg."</font><br>\n";
		}
		
		/**
		 * Method used to throw exceptions
		 * @param $msg
		 * @return void
		 */
		public static function exception($msg)
		{
			if (function_exists('fb') && POPEnvironment::$firephp){FB::error($msg);}
			throw new Exception($msg);			
		}
	}
?>